<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>个人中心</title>
    <link rel="stylesheet" type="text/css" href="../../css/aui.css" />
    <link rel="stylesheet" type="text/css" href="../../css/style.css" />
    <link rel="stylesheet" type="text/css" href="../../css/base.css" />
<style>
body{background-color: #fff;min-height: 100%}
.aui-list .aui-list-item-inner.aui-list-item-arrow{padding-right:12px}
.qd_tc{position: fixed;;width: 100%;height: 100%;background-color: rgba(0,0,0,0.5);left: 0;top: 0;z-index: 10000000;display:none}
.qd_tc img{position: absolute;left: 50%;top: 50%;transform: translate(-50%,-50%);width:400px;;}
.toglogin{position: fixed;z-index: 100000;background-color: rgba(0,0,0,0.2);left: 0;top: 0;width: 100%;height: 100%;display: none;}
#toglogin{min-height: 100%;height: 100%;}
.toglogin .con{width: 273px;height: 310px;box-sizing: border-box;;border-radius: 8px;position: absolute;left: 50%;top: 50%;transform: translate(-50%,-50%);background-color: #fff;padding: 10px;padding-top: 10px;}
.toglogin .con h5{font-size: 13px;color: #333;line-height: 13px;margin-bottom:17px;}
.toglogin .con .col {width: 100%;height: 90px;background-color: #fc6d4d;box-sizing: border-box;padding: 19px 20px;margin-bottom: 10px;}
.toglogin .con .col span{width: 52px;height: 52px;box-sizing: border-box;border-radius: 50%;float: left;margin-right: 18px;position: relative;background-color: #fff}
.toglogin .con .col span img{width:100%;position: absolute;left: 50%;top: 50%;transform: translate(-50%,-50%);}
.toglogin .con .col .togri{float:left;width: 143px;background-image: url(../../image/togloginar.svg);background-position: right center;background-repeat: no-repeat;background-size: 5px 9px;box-sizing: border-box;padding-top: 9px;}
.toglogin .con .col .togri h6{font-size: 13px;line-height: 13px;color: #fff;margin-bottom:12px;}
.toglogin .con .col .togri p{color:#fff;font-size: 12px;line-height: 12px;}
.clearfix{clear: both;}
.box-sign{border: 1px solid #fff;color: #fff}
img.aui-img-round{border: none}
.head-title{padding: 40px 15px}
.box-demo{margin-top: 12px; overflow: hidden;}
.sim-bg{background-color: }
.box-sign{padding: 0 7px;}
#name-id{font-size: 14px;line-height: 14px;text-align: left;margin-right: 8px;display: inline-block;}
.box-demo{font-size: 12px;color: #fff;background-color: rgba(255,255,255,0.25)}

.aui-list .aui-list-item-title{font-size: 13px;}
.icon-list{margin-right: 9px;width: 13px;}
.aui-list .aui-list-item{border: none!important;padding-left: 15px;padding-right: 15px;;width: 100%;box-sizing: border-box;;outline: none!important}
.aui-list .aui-list-noborder, .aui-list.aui-list-noborder{padding: 0px;width: 100%;box-sizing: border-box;}
.right-icon{text-align: right;position: absolute;;right: 0;top: 50%;transform: translateY(-50%);}
.user-name img{display: inline-block;vertical-align: middle;width: 50px;height: 13px;}
#senfeny{background-color: #F5BF95}
.bg-span{background-color: rgba(168,163,253,0.5);display: inline-block;width: 100%;height: 100%;}
</style>
</head>
<body>
  <div  id="person">
	<!--头部-->
	<section class="aui-content" id="user-info" style="padding: 0;margin: 0;background-color: #999;overflow-x: hidden;word-break: break-all;" >
      <div >
                <div class="aui-media-list-item-inner head-title"  style="margin: 0;height:224px;box-sizing:border-box;width:100%;background-image: url(../../image/geren_bg.jpg);background-repeat: no-repeat;background-position: center center;background-size: cover;">
                    <div class="aui-list-item-media" style="width:66px;height:66px;border-radius:50%;box-sizing:border-box;overflow:hidden; margin-top:40px;box-sizing:border-box;border:5px solid rgba(255,255,255,0.25)"  onclick="fnzlxg()">
                        <img v-bind:src="img"  class="aui-img-round"  style="width:100%;">
                    </div>

                    <div class="aui-list-item-inner aui-list-item-arrow user-name" style="left:90px;margin-top:2px;">
                        <div class="aui-list-item-text text-white aui-font-size-18" id="name-id">{{title==""?"未命名":title}}</div>
                        <img src="../../image/renzheng.png" alt="" v-if='ren'>
                        <div class="aui-list-item-text text-white"  id="person_site">
                           <div class="box-demo" onclick="state();" id="state">{{state}}</div>
                            <div class="box-demo sim-bg" id="senfeny"></div>
                        </div>

                    </div>
                    <div class="aui-list-item-inner aui-list-item-arrow signin"  style="position: absolute;;right: 0;top: 50%;transform: translateY(-50%)">
                         <div class="aui-list-item-text text-white">
                           <div class="box-sign" ><img src="../../image/qd.png" class="icon-qi" ><span id="qdtext"   onclick="qd()" v-if="qiandao" >每日签到</span><span v-else="qiandao">已签到</span></div>
                        </div>


                	</div>
                  <div style="clear:both"></div>
                  </div>
    </section>
    <div class="qd_tc" id="qd_tc" >
      <img src="../../image/qd_tc.png" alt="">
    </div>
	<!--内容列表-->
    <section class="aui-content" id="personlist">
        <ul class="aui-list aui-list-noborder">
            <li class="aui-list-item" onclick="fnitem('参与项目')" v-if="yi" >
                <div class="aui-list-item-inner aui-list-item-arrow">
                    <div class="aui-list-item-title" ><img src="../../image/xm.png" class="icon-list"><span id="fabu">参与项目</span></div>
                    <div class="right-icon">
                    	<img src="../../image/right.png">
                    </div>
                </div>
            </li>
            <li class="aui-list-item" onclick="fnitem('我的发布')"  v-if="er">
                <div class="aui-list-item-inner aui-list-item-arrow">
                    <div class="aui-list-item-title"><img src="../../image/xm.png" class="icon-list"><span id="fabu">我的发布</span></div>
                    <div class="right-icon">
                      <img src="../../image/right.png">
                    </div>
                </div>
            </li>
            <li class="aui-list-item" onclick="fnpicpost('我的证件')" v-if="san">
                <div class="aui-list-item-inner aui-list-item-arrow">
                    <div class="aui-list-item-title"><img src="../../image/zj.png" class="icon-list" ><span id="zhengshu">我的证件</span></div>
                    <div class="right-icon">
                    	<img src="../../image/right.png">
                    </div>
                </div>
            </li>
            <li class="aui-list-item" onclick="fnpicpost('我的证书')" v-if="si">
                <div class="aui-list-item-inner aui-list-item-arrow">
                    <div class="aui-list-item-title"><img src="../../image/zj.png" class="icon-list" ><span id="zhengshu">我的证书</span></div>
                    <div class="right-icon">
                      <img src="../../image/right.png">
                    </div>
                </div>
            </li>
            <li class="aui-list-item" onclick=" fnxiangmu()" v-if="wu">
                <div class="aui-list-item-inner aui-list-item-arrow">
                    <div class="aui-list-item-title"><img src="../../image/tongzhi.png" class="icon-list"><span id="fabu">项目通知</span></div>
                    <div class="right-icon">
                      <img src="../../image/right.png">
                    </div>
                </div>
            </li>
            <li class="aui-list-item" onclick="fnnumber()"  v-if="liu">
                <div class="aui-list-item-inner aui-list-item-arrow">
                    <div class="aui-list-item-title" ><img src="../../image/jf.png" class="icon-list">我的积分</div>
                	<span class="branch" style="position:absolute;right:95px;"><b  id="jifen" style="font-weight:normal" style="line-height:40px;">{{jifen}}</b>积分</span>
                	<div class="right-icon">
                    	<img src="../../image/right.png">
                    </div>
                </div>
            </li>
            <li class="aui-list-item" onclick="fnsao()" v-if="shi">
                <div class="aui-list-item-inner aui-list-item-arrow">
                    <div class="aui-list-item-title"><img src="../../image/saoma.png" class="icon-list">扫一扫</div>
                    <div class="right-icon">
                      <img src="../../image/right.png">
                    </div>
                </div>
            </li>
            <li class="aui-list-item" onclick="fndjnumber()"  v-if="qi">
                <div class="aui-list-item-inner aui-list-item-arrow">
                    <div class="aui-list-item-title" ><img src="../../image/jf.png" class="icon-list">积分中心</div>
                  <span class="branch" style="position:absolute;right:95px;"></span>
                  <div class="right-icon">
                      <img src="../../image/right.png">
                    </div>
                </div>
            </li>
            <li class="aui-list-item" onclick="fnpingjia()" v-if="ba">
                <div class="aui-list-item-inner aui-list-item-arrow">
                    <div class="aui-list-item-title"><img src="../../image/pj.png" class="icon-list" style="margin-right:6px;"> 雇主评价</div>
                    <div class="right-icon">
                    	<img src="../../image/right.png">
                    </div>
                </div>
            </li>
            <li class="aui-list-item" onclick="fnhyk()" v-if="jiu">
                <div class="aui-list-item-inner aui-list-item-arrow">
                    <div class="aui-list-item-title"><img src="../../image/huiyuanka.png" class="icon-list" style="margin-right:6px;">我的会员卡</div>
                    <div class="right-icon">
                      <img src="../../image/right.png">
                    </div>
                </div>
            </li>


            <li class="aui-list-item" onclick="fnzlxg()">
                <div class="aui-list-item-inner aui-list-item-arrow">
                    <div class="aui-list-item-title"><img src="../../image/tx.png" class="icon-list">资料修改</div>
                    <div class="right-icon">
                      <img src="../../image/right.png">
                    </div>
                </div>
            </li>

            <li class="aui-list-item" onclick="fntoglogin()" >
                <div class="aui-list-item-inner aui-list-item-arrow">
                    <div class="aui-list-item-title"><img src="../../image/qh.png" class="icon-list" >切换身份</div>
                    <div class="right-icon">
                    	<img src="../../image/right.png">
                    </div>
                </div>
            </li>


            <li class="aui-list-item" onclick="fnLogn()">
                <div class="aui-list-item-inner aui-list-item-arrow">
                    <div class="aui-list-item-title"><img src="../../image/qhzh.png" class="icon-list">退出登录</div>
                    <div class="right-icon">
                      <img src="../../image/right.png">
                    </div>
                </div>
            </li>
        </ul>
        <!-- 切换身份 -->
        <div class="toglogin" id="toglogin" onclick="personclose()">
            <div class="con">
                <div >
                <div class="col" onclick="fnlogin(1)" >
                  <span><img src="../../image/wajueji.png"></span>
                  <div class="togri">
                  <h6>我有挖掘机</h6>
                  <p>海量机手 放心雇佣</p>
                  </div>
                  <div class="clearfix"></div>
                </div>
                <div class="col" onclick="fnlogin(2)" >
                  <span><img src="../../image/geren.png"></span>
                  <div class="togri">
                  <h6>我是机手</h6>
                  <p>海量机手 放心雇佣</p>
                  </div>
                  <div class="clearfix"></div>
                </div>
                <div class="col" onclick="fnlogin(3)" >
                  <span><img src="../../image/dianjia.png"></span>
                  <div class="togri">
                  <h6>我是店家</h6>
                  <p>海量机手 放心雇佣</p>
                  </div>
                  <div class="clearfix"></div>
                </div>
                </div>
            </div>
        </div>
    </section>
</div>
</body>
<script type="text/javascript" src="../../script/api.js" ></script>
<script type="text/javascript" src="../../script/vue.min.js" ></script>
<script type="text/javascript">

apiready = function(){
  var sfsf = $api.byId('senfeny');
  api.ajax({
      url: $api.getStorage("backapi")+'/index.php?c=home&m=cha_ajax&id='+$api.getStorage("member")+"&sys="+$api.getStorage("sys"),
      method: 'get',
  },function(ret, err){
      if (ret) {
        if(ret.status.identity=='1'){
       $api.text($api.byId('senfeny'),'我有挖掘机');
              }else if(ret.status.identity=='2'){
       $api.text($api.byId('senfeny'),'我是机手');
              }else if(ret.status.identity=='3'){
       $api.text($api.byId('senfeny'),'我是店家');
              }


           console.log(ret.status.identity)

      } else {
          console.log( JSON.stringify( err ) );
      }
  });






  api.addEventListener({
    name: 'shuaxin'
}, function(ret, err) {
setTimeout(function(){  window.location.reload()}, 100);
});

            var member = $api.getStorage("member");
            // console.log(member)
            if(!member){
            api.openWin({
                name: 'login',
                url: 'widget://html/person/login_win.html',
                  slidBackEnabled: false,
                pageParam: {
                    name: 'test'
                }
            });
          }
          cha_ajax();
          uptouxiang();
          getxinxi();

   person = new Vue({
             el: '#person',
             data: {
                     title: '未命名的用户',
                     img:'../../image/Boyfriend.jpg',
                     state:"在线中",
                     qiandao:true,
                     jifen:999,
                     yi:true,
                     er:false,
                    san:true,
                    si:false,
                      wu:true,
                      liu:true,
                      qi:false,
                      ba:true,
                      jiu:true,
                      shi:false,
                      ren:false,
                 }
         });



    api.showProgress({
        style: 'default',
        animationType: 'fade',
        title: '努力加载中...',
        text: '先喝杯茶...',
        modal: false
    });
api.setRefreshHeaderInfo({
    loadingImg: 'widget://image/refresh.png',
    bgColor:  'rgba(0,0,0,0)',
    textColor: '#333',
    textDown: '下拉刷新...',
    textUp: '松开刷新...'
}, function(ret, err) {
    cha_ajax();
    uptouxiang();
    //查询头像，昵称，邮箱，签到，状态，积分，不存在则存到本地
    getxinxi();
});


//是否每次打开重新获取$api.rmStorage('grxx');
if($api.getStorage("shenfen") == 1){
  $api.text(sfsf, '我有挖掘机');
  person.yi=false;
  person.er=true;
  person.san=true;
  person.si=false;
  person.wu=true;
  person.liu=true;
  person.qi=false;
  person.ba=false;
  person.jiu=false;
  person.shi=false;
}else if($api.getStorage("shenfen") == 2){
  console.log('我是机手')
  $api.text(sfsf, '我是机手');
  person.yi=true;
  person.er=false;
  person.san=true;
  person.si=false;
  person.wu=true;
  person.liu=true;
  person.qi=false;
  person.ba=true;
  person.jiu=true;
  person.shi=false;
}else if($api.getStorage("shenfen") == 3){
  $api.text(sfsf, '我是店家');
  person.yi=false;
  person.er=false;
  person.san=false;
  person.si=false;
  person.wu=false;
  person.liu=false;
  person.qi=true;
  person.ba=false;
  person.jiu=false;
  person.shi=true;
}

if($api.getStorage("touxiang")){
  person.img = $api.getStorage("touxiang");
}else{
    uptouxiang()
}
// console.log($api.getStorage("shenfen"));
// console.log('上面是身份')

     };
var sfsf;
     function   fnxiangmu(){
        api.openWin({
            name: 'xmjj_list_win',
            url: 'xmjj_list_win.html',
            pageParam:{
              sf:$api.getStorage("shenfen")
            }

        });


      }
       var perso,dianjia;

     function  fnhyk(){

       api.openWin({
           name: 'hyk_win',
             slidBackEnabled:true,
           url: 'hyk_win.html',
           pageParam: {
               number: utext
           }
       });
       api.showProgress({
           style: 'default',
           animationType: 'fade',
           title: '努力加载中...',
           text: '先喝杯茶...',
           modal: false
       });
       api.hideProgress();

     }


            function  fnpingjia(){
              api.openWin({
                  name: 'pingjia_win',
                    slidBackEnabled:true,
                  url: 'pingjia_win.html',
                  pageParam: {
                      number: utext
                  }
              });
              api.showProgress({
                  style: 'default',
                  animationType: 'fade',
                  title: '努力加载中...',
                  text: '先喝杯茶...',
                  modal: false
              });
              api.hideProgress();

            }
    function fntoglogin(){

          if($api.getStorage("shenfen") == 1){

            $api.text(sfsf, '我有挖掘机');

          }else if($api.getStorage("shenfen") == 2){
            // console.log('我是机手')
              $api.text(sfsf, '我是机手');

          }else if($api.getStorage("shenfen") == 3){
            $api.text(sfsf, '我是店家');

          }


       var  body=$api.dom("body")
       var t = api.winHeight;
       body.style.height=t+"px";
      $api.css(body, 'background-color:rgba(0,0,0,0.0001)');

       var toglogin=$api.byId('toglogin');
       toglogin.style.height=t+"px";
     $api.css(toglogin, 'display:block');


     }


    var u=$api.byId("jifen")
  var utext=$api.text(u);


    function fnnumber(){
      api.openWin({
          name: 'number_win',
            slidBackEnabled:true,
          url: 'number_win.html',
          pageParam: {
              number: $api.getStorage('jifen')?$api.getStorage('jifen'):0

          }
      });
      api.showProgress({
          style: 'default',
          animationType: 'fade',
          title: '努力加载中...',
          text: '先喝杯茶...',
          modal: false
      });
      api.hideProgress();

    }
    function fndjnumber(){
      api.openWin({
          name: 'djnumber_win',
            slidBackEnabled:true,
          url: 'djnumber_win.html',
          pageParam: {
              number: $api.getStorage('jifen')?$api.getStorage('jifen'):0

          }
      });
      api.showProgress({
          style: 'default',
          animationType: 'fade',
          title: '努力加载中...',
          text: '先喝杯茶...',
          modal: false
      });
      api.hideProgress();

    }
    var zs=$api.byId("zhengshu")
  var zsti=$api.text(zs);
     function fnpicpost(data){
       api.openWin({
           name: 'picpost_win',
             slidBackEnabled:true,
           url: 'picpost_win.html',
           pageParam: {
               name: data,
               geshu:$api.getStorage("geshu")
           }
       });
       api.showProgress({
           style: 'default',
           animationType: 'fade',
           title: '努力加载中...',
           text: '先喝杯茶...',
           modal: false
       });
       api.hideProgress();

     }

function fnlogin(data){
  $api.setStorage('shenfen',data);

  //console.log($api.getStorage("sftg"));
  if(data==1){

if($api.getStorage("sftg")==1){
  api.ajax({
      url: $api.getStorage("backapi")+'/index.php?c=home&m=identity&uid='+$api.getStorage("member")+'&identity='+data+"&sys="+$api.getStorage("sys"),
      method: 'get',
  },function(ret, err){
      if (ret) {
        $api.setStorage('shenfen',ret.status);
        if(ret.status == 1){
  $api.html($api.byId('senfeny'), '我有挖掘机');
          person.yi=false;
          person.er=true;
          person.san=true;
          person.si=false;
          person.wu=true;
          person.liu=true;
          person.qi=false;
          person.ba=false;
          person.jiu=false;
          person.shi=false;

        }else if(ret.status == 2){
  $api.html($api.byId('senfeny'), '我是机手');
          person.yi=true;
          person.er=false;
          person.san=true;
          person.si=false;
          person.wu=true;
          person.liu=true;
          person.qi=false;
          person.ba=true;
          person.jiu=true;
          person.shi=false;

        }else if(ret.status == 3){
              $api.html($api.byId('senfeny'), '我是店家');
          person.yi=false;
          person.er=false;
          person.san=false;
          person.si=false;
          person.wu=false;
          person.liu=false;
          person.qi=true;
          person.ba=false;
          person.jiu=false;
          person.shi=true;
          dianjia="yes"
        }

       //   console.log( JSON.stringify( ret ) );
      }
  });



}else if($api.getStorage("sftg")==0){
  api.toast({
      msg: '资料正在审核中，请耐心等待',
      duration: 2000,
      location: 'bottom'
  });

}else{
  api.openWin({
      name: 'picpost_win',
      url: 'picpost_win.html',
      pageParam: {
          sftg:1
      }
  });
}

  }else{



  console.log(data);
  api.showProgress({
     style: 'default',
     animationType: 'fade',
     title: '努力加载中...',
     text: '先喝杯茶...',
     modal: false
 });
 api.ajax({
     url: $api.getStorage("backapi")+'/index.php?c=home&m=identity&uid='+$api.getStorage("member")+'&identity='+data+"&sys="+$api.getStorage("sys"),
     method: 'get',
 },function(ret, err){
     if (ret) {
       if(data==2){
         $api.css($api.byId('state'), 'display:block');
          $api.html($api.byId('senfeny'), '我是机手');

       }else{
         $api.css($api.byId('state'), 'display:none');
       }
       $api.setStorage('shenfen',ret.status);
       api.sendEvent({
           name: 'reload',
       });

       if(ret.status == 1){
           $api.html($api.byId('senfeny'), '我有挖掘机');
         person.yi=false;
         person.er=true;
         person.san=true;
         person.si=false;
         person.wu=true;
         person.liu=true;
         person.qi=false;
         person.ba=false;
         person.jiu=false;
         person.shi=false;
       }else if(ret.status == 2){
           $api.html($api.byId('senfeny'), '我是机手');
         person.yi=true;
         person.er=false;
         person.san=true;
         person.si=false;
         person.wu=true;
         person.liu=true;
         person.qi=false;
         person.ba=true;
         person.jiu=true;
         person.shi=false;
       }else if(ret.status == 3){
           $api.html($api.byId('senfeny'), '我是店家');
         person.yi=false;
         person.er=false;
         person.san=false;
         person.si=false;
         person.wu=false;
         person.liu=false;
         person.qi=true;
         person.ba=false;
         person.jiu=false;
         person.shi=true;
         dianjia="yes"
       }

       api.sendEvent({
           name: 'sfqh',
       });

      //   console.log( JSON.stringify( ret ) );
     }
 });

  }


       var toglogin=$api.byId( 'toglogin');
       $api.css(toglogin, 'display:none');
       api.hideProgress();
       api.showProgress({
           style: 'default',
           animationType: 'fade',
           title: '努力加载中...',
           text: '先喝杯茶...',
           modal: false
       });


       var jsfun = 'ajax();';
       api.execScript({
         frameName: 'publicitem',
         script: jsfun
      });



             cha_ajax();
   }






function fnitem(data){

    api.openWin({
        name: 'cyxm_win',
          slidBackEnabled:true,
        url: 'cyxm_win.html',
        pageParam: {
            name:data
        }
    });



  api.showProgress({
      style: 'default',
      animationType: 'fade',
      title: '努力加载中...',
      text: '先喝杯茶...',
      modal: false
  });
  api.hideProgress();
}





 function qd(){



         var qdtc=$api.byId("qd_tc")
          var qd=$api.byId("qdtext")

          //console.log($api.getStorage("member"));
          api.ajax({
              url: $api.getStorage("backapi")+'/index.php?c=home&m=qiandao_ajax&id='+$api.getStorage("member")+"&sys="+$api.getStorage("sys"),
              method: 'get',
          },function(ret, err){
              if (ret.status) {
                 person.qiandao=false;
                $api.css(qdtc,'display:block');
               setTimeout(   function qdtc(){ var qdtc=$api.byId("qd_tc");  $api.css(qdtc,'display:none'); },1500)
              } else {
                  console.log( JSON.stringify( err ) );
                  api.toast({
                      msg: '签到失败',
                      duration: 2000,
                      location: 'bottom'
                  });

              }
          });


 }



function fnzlxg(){
 api.openWin({
     name: 'zlxg_win',
       slidBackEnabled:true,
     url: 'zlxg_win.html',
     pageParam: {
         dianjia:dianjia,
     }
 });



 api.showProgress({
     style: 'default',
     animationType: 'fade',
     title: '努力加载中...',
     text: '先喝杯茶...',
     modal: false
 });
 api.hideProgress();
}




function cha_ajax(){

  api.ajax({
      url: $api.getStorage("backapi")+'/index.php?c=home&m=cha_ajax&id='+$api.getStorage("member")+"&sys="+$api.getStorage("sys"),
      method: 'GET',
  },function(ret, err){
      if (ret.status) {
        console.log(ret.status.qd);
        $api.setStorage('name', ret.status.name);
        $api.setStorage("phone",ret.status.phone);
        $api.setStorage("jianjie",ret.status.jianjie);
        $api.setStorage("zhuangtai",ret.status.zt);
        $api.setStorage("jifen",ret.status.jf);
        $api.setStorage("qiandao",ret.status.qd);
        $api.setStorage("grxx","yes");
        $api.setStorage('shenfen',ret.status.identity);
        $api.setStorage("shebei",ret.status.shebei);
        $api.setStorage("dizhi",ret.status.dizhi);
        $api.setStorage("nianxian",ret.status.jingyan);
        $api.setStorage("age",ret.status.age);

      if(ret.status.type==1){
        person.ren=true
      }
        //console.log(ret.status.identity);




        if($api.getStorage("shenfen") == 1){
            $api.html($api.byId('senfeny'), '我有挖掘机');
                    // $api.css($api.byId("person_site"), 'display:none');
        //  console.log(1);
       $api.css($api.byId('state'), 'display:none');
          dianjia=""


        }else if($api.getStorage("shenfen") == 2){
            $api.html($api.byId('senfeny'), '我是机手');
  $api.css($api.byId("person_site"), 'display:block');
 $api.css($api.byId('state'), 'display:block');
        //  console.log(2);

          dianjia=""
        }else if($api.getStorage("shenfen") == 3){
            $api.html($api.byId('senfeny'), '我是店家');
              // $api.css($api.byId("person_site"), 'display:none');

       $api.css($api.byId('state'), 'display:none');
          dianjia="yes"

        }
        api.sendEvent({
            name: 'sfqh',
        });

          getxinxi();
          api.hideProgress();
          api.refreshHeaderLoadDone()
      } else {
        api.refreshHeaderLoadDone()
        api.toast({
            msg: '获取信息失败',
            duration: 2000,
            location: 'bottom'
        });

      }
  });

api.ajax({
    url: $api.getStorage("backapi")+'/index.php?s=jishou&c=home&m=renzheng&uid='+$api.getStorage("member"),
    method: 'post',
},function(ret, err){
    if (ret) {
      if(ret.code == null){
        $api.setStorage('sftg',"null");
      }else if(ret.code.sftg){
        $api.setStorage('sftg',ret.code.sftg);
      }
        //console.log( JSON.stringify( ret ) );
    } else {
      //  console.log( JSON.stringify( err ) );
    }
});




}


function getxinxi(){
  var thisdata = new Date().getTime();
  person.title=$api.getStorage("name");
  person.jifen=$api.getStorage("jifen");
  var zut = $api.getStorage("zhuangtai");
    var zxfa = $api.byId("state")
  if(zut==0){
    // person.state="在线中";

      $api.html(zxfa, '<span class="bg-span">在线中</span>');
  }else if(zut==1){
    // person.state="已离线";
      $api.html(zxfa, '<span>已离线</span>');

  }
  console.log($api.getStorage("qiandao"));
  console.log(thisdata);
  if( thisdata - $api.getStorage("qiandao")*1000 > 86400000){
    person.qiandao=true
  }else{
        person.qiandao=false
   }



}




function uptouxiang(){
  api.imageCache({
          thumbnail : true,
          url : $api.getStorage("backapi")+'/uploadfile/member/'+$api.getStorage("member")+'/800x800.jpeg?txscsj='+(new Date()).getTime(),
          policy:'cache_only',
  }, function(ret, err) {
          var url = ret.url;
          //console.log(url + "*" + ret.status);
          if (ret.status) {

             $api.setStorage('touxiang',url);
            // console.log(zlxg.touxiang);
          }else{
             $api.setStorage('touxiang','../../image/Boyfriend.jpg');
          }
  });
person.img = $api.getStorage('touxiang');

}



function personclose(){
  var toglogin=$api.byId( 'toglogin');
  var  body=$api.dom("body")
  var t = api.winHeight;
  body.style.height=t+"px";
 $api.css(body, 'background-color:rgba(255,255,255,1)');

  var toglogin=$api.byId('toglogin');
  toglogin.style.height=t+"px";
$api.css(toglogin, 'display:none');
}



function fnLogn(){
  $api.rmStorage('member');
console.log($api.getStorage('member'))
  api.showProgress({
      style: 'default',
      animationType: 'fade',
      title: '正在退出登录...',
      text: '请稍后...',
      modal: false
  });
api.hideProgress();
api.toast({
    msg: '退出成功',
    duration: 2000,
    location: 'bottom'
});
$api.setStorage("shenfen",2)
var jsfun = 'ajax();';
api.execScript({
  frameName: 'publicitem',
  script: jsfun
});
location.reload();
}
function fnsao(){
  var FNScanner = api.require('FNScanner');
  FNScanner.open({
      autorotation: true
  }, function(ret, err) {
      if (ret.content) {
        api.openWin({
            name: 'ewmshow',
            url: 'ewmshow_win.html',
            pageParam: {
                id:ret.content
            }
        });
      } else {

      }
  });


}





function state(){

  var text = $api.text($api.byId('state'));
  if(text=="在线中"){
    var state = 1
  }else if(text == "已离线"){
    var state =0
  }
  console.log(state);

  api.ajax({
      url: $api.getStorage("backapi")+'/index.php?c=home&m=state&uid='+$api.getStorage("member")+"&sys="+$api.getStorage("sys"),
      method: 'post',
  },function(ret, err){
      if (ret) {
          var zxfa = $api.byId("state")
        console.log(JSON.stringify(ret));
        if(state==0){

          // person.state="在线中";
            $api.html(zxfa, '<span class="bg-span">在线中</span>');
          api.toast({
              msg: '状态切换为在线中，信息将展示',
              duration: 2000,
              location: 'bottom'
          });

        }else if(state==1){

          // person.state="已离线";
            $api.html(zxfa, '<span>已离线</span>');
          api.toast({
              msg: '状态切换为已离线，信息将不展示',
              duration: 2000,
              location: 'bottom'
          });
        }

      } else {
          console.log( JSON.stringify( err ) );
      }
  });


}

     </script>
</html>
